import request from '../request'

// 账号密码登录
export function passwordLogin(data) {
  return request({
    url: '/api/v1/auth/login',
    method: 'post',
    data: {
      username: data.username,
      password: data.password
    }
  })
}

// 短信验证码登录 
export function smsLogin(data) {
  return request({
    url: '/api/v1/auth/sms',
    method: 'post',
    data: {
      phone: data.phone,
      code: data.code
    }
  })
}

// 获取用户信息
export function getInfo() {
  return request({
    url: '/api/v1/users/profile',
    method: 'get'
  })
}

// 更新用户信息
export function updateInfo(data) {
  return request({
    url: '/user/info',
    method: 'put',
    data
  })
}

// 退出登录
export function logout() {
  return request({
    url: '/api/v1/auth/logout',
    method: 'post',
    data:{}
  })
}
